<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('柜员登记')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li class="select-time">
                            <p>交易日期：</p>
                            <input type="text" class="time-input" placeholder="交易日期" id="trDate" name="trDate"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="_addTellers()"><i class="fa fa-search"></i>查询柜员</a>
                        </li>
                        <li th:align="right">
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="_saveBms()"><i class="fa fa-search"></i>提交</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" class="table-bordered table-hover table-striped"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
   // var editFlag = [[${@permission.hasPermi('data:proc:edit')}]];
   // var removeFlag = [[${@permission.hasPermi('data:proc:remove')}]];
   // var processFlagDatas = [[${@dict.getType('ds_tr_date_pro')}]];
   // var stateDatas = [[${@dict.getType('ds_tr_date_state')}]];
    var prefix = ctx + "bms/bmsVoucherAssociate";


       var options = {
           url: prefix + "/listTellers",
           //sortName: "createTime",
           //sortOrder: "desc",
           showSearch: false,
           showRefresh: false,
           showToggle: false,
           showColumns: false,
           clickToSelect: false,
           columns: [{
                   title: "序号",
                   width: '10%',
                   align:"center",
                   formatter: function (value, row, index) {
                       return $.table.serialNumber(index);
                   }
               },
               {
                   field: 'tellerCode',
                   title: '柜员号',
                   align:"center",
                   width: '50%',
                   sortable: true
               },

               {
                   field: 'noteNum',
                   title:"凭证张数",
                   align:"center",
                   editable: true,
                   formatter: function (value, row, index) {
                       return "0";
                   }
               }]
       };
   function _addTellers() {
       $.table.destroy();
       $.table.init(options);
   }


   function _saveBms() {
       var addUrl = prefix + "/addBms";
       var data = $("#" + table.options.id).bootstrapTable('getData');
       var dataMsg = JSON.stringify(data);
       $.ajax({
           url: addUrl,
           type: 'post',
           cache: false,
           data: dataMsg,
           processData: false,
           contentType: "application/json",
           dataType: "json",
           success: function(result) {
               if (result.code == 0) {
                   layer.msg("保存成功,正在刷新数据请稍后……", {
                       icon: 1,
                       time: 500,
                       shade: [0.1, '#8F8F8F']
                   },function() {
                       $.table.refresh();
                   });
               } else {
                   alert(result.msg);
               }
           }
       });

   }


</script>
</body>
</html>